package com.south.ikun.main;

import com.south.ikun.util.AudioPlay2;

import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class IkunMain extends Frame {
    public  IkunMain(){
        this.setBounds(400,300,400,400);
        Toolkit kit = Toolkit.getDefaultToolkit();
        Dimension screenSize = kit.getScreenSize();
        int screenWidth = screenSize.width;
        int screenHeight = screenSize.height;
        this.setLocation(screenWidth/2-400/2, screenHeight/2-300/2);
        this.setVisible(true);

        TextArea textArea = new TextArea();
        this.addKeyListener(new KeyAdapter() {
            @Override
            public void keyReleased(KeyEvent e) {
                switch (e.getKeyCode()){
                    case KeyEvent.VK_J : new AudioPlay2("D:\\java项目\\spring_demos\\Truth-ikun\\src\\main\\resources\\videos\\鸡.wav"); break;
                    case KeyEvent.VK_N : new AudioPlay2("D:\\java项目\\spring_demos\\Truth-ikun\\src\\main\\resources\\videos\\你.wav"); break;
                    case KeyEvent.VK_T : new AudioPlay2("D:\\java项目\\spring_demos\\Truth-ikun\\src\\main\\resources\\videos\\太.wav"); break;
                    case KeyEvent.VK_M : new AudioPlay2("D:\\java项目\\spring_demos\\Truth-ikun\\src\\main\\resources\\videos\\鸡你太美.wav"); break;
                }
            }
        });
        textArea.setBounds(400,280,400,280);
        this.add(textArea);
//        this.dispose();

    }

    public static void main(String[] args) {
        new IkunMain();
    }
}

